% preprocess data
marm3Dpreprocessing;

% fit data
[fitobject,gof,output] = fit([allpoints(:,1:2)],allpoints(:,3),'poly11','Weights',bootpars.weights);
fres.p00 = fitobject.p00;
fres.p10 = fitobject.p10;
fres.p01 = fitobject.p01;
fres.confintervalls = confint(fitobject,0.95);
fres.coeffStandardDevs = mean(abs(confint(fitobject,0.683)-mean(confint(fitobject,0.683),1)),1);

% postprocess data
marm3Dpostprocessing;

% report result
fitresults.fitobject = fitobject;
fitresults.gof = gof;
fitresults.output = output;
fitresults.fres = fres;
disp('Report fit standard regression')
disp('sf(x,y) = p00 + p10*x + p01*y')
disp('Coefficients (with 95% confidence bounds):')
disp(['p00 =      ' num2str(fres.p00) '  (' num2str(fres.confintervalls(1,1)) ',' num2str(fres.confintervalls(2,1)) ')'])
disp(['p10 =      ' num2str(fres.p10) '  (' num2str(fres.confintervalls(1,2)) ',' num2str(fres.confintervalls(2,2)) ')'])
disp(['p01 =      ' num2str(fres.p01) '  (' num2str(fres.confintervalls(1,3)) ',' num2str(fres.confintervalls(2,3)) ')'])
disp(['std_p00 =      ' num2str(fres.coeffStandardDevs(1))])
disp(['std_p10 =      ' num2str(fres.coeffStandardDevs(2))])
disp(['std_p01 =      ' num2str(fres.coeffStandardDevs(3))])
disp(' ');


disp('Printing fres:');
fres
disp(' ');
disp('Printing GoF:');
gof
disp(' ');
disp('Printing output:');
output
disp(' ');
